#pragma once

#include "ann_m.h"
#include "ann_pre.h"

namespace ann
{

class node
{
public:
    node(const UINT pInCnt, const EXCIT_FUNC pExFunc, const double pB = 0.0)
    : m_inCnt(pInCnt),
      m_inVec(NULL),
      m_data(0.0),
      m_exFunc(pExFunc),
      m_b(pB)
    {
        m_inVec = new double[pInCnt];
        std::fill(m_inVec, m_inVec+pInCnt, 0.0);
    }

    virtual ~node(void)
    {
        SAFE_DELA(m_inVec);
    }

    virtual const double tick   (const double*, const UINT  ) = 0; 
    virtual const UINT   UpdateW(const double , const double) = 0;

    ACCESSOR(m_inCnt, UINT)
    ACCESSOR_IDX(m_inVec, double)
    GETBEGIN(m_inVec, double)
    ACCESSOR(m_data, double)
    ACCESSOR(m_b, double)
    ACCESSOR(m_exFunc, EXCIT_FUNC)

protected:
    const UINT SaveInVec(const double* pInVec)
    {
        std::copy(pInVec, pInVec+m_inCnt, m_inVec);
        return eann_Normal;
    }

protected:
    UINT    m_inCnt;
    double* m_inVec;
    double  m_data;

    EXCIT_FUNC m_exFunc;

    double  m_b;
};

}
